<pre id="console"></pre>
<script>
    if (window.testRunner)
        testRunner.dumpAsText();

    function log(message)
    {
        document.getElementById("console").appendChild(document.createTextNode(message + "\n"));
    }

    function test(value, expectedCSSText, expectedComputedCSSText)
    {
        var element = document.createElement("div");
        element.style.setProperty("font-variant-ligatures", value);
        var cssText = element.style.fontVariantLigatures;
        document.body.appendChild(element);
        var computedCSSText = getComputedStyle(element).fontVariantLigatures;
        document.body.removeChild(element);
        if (cssText === expectedCSSText && computedCSSText == expectedComputedCSSText)
            log("PASS: '" + value + "' parsed as '" + expectedCSSText + "' and computed to '" + computedCSSText + "'");
        else {
            if (cssText !== expectedCSSText)
                log("FAIL: '" + value + "' parsed as '" + cssText + "' rather than '" + expectedCSSText + "'");
            if (computedCSSText !== expectedComputedCSSText)
                log("FAIL: '" + value + "' computed to '" + computedCSSText + "' rather than '" + expectedComputedCSSText + "'");
        }
    }

    test('initial', 'initial', 'normal');
    test('inherit', 'inherit', 'normal');
    test('normal', 'normal', 'normal');
    test('large', '', 'normal');
    test('25px', '', 'normal');
    test('normal normal', '', 'normal');
    test('normal no-common-ligatures', '', 'normal');

    log("");
    test('no-common-ligatures', 'no-common-ligatures', 'no-common-ligatures');
    test('common-ligatures', 'common-ligatures', 'common-ligatures');
    test('no-discretionary-ligatures', 'no-discretionary-ligatures', 'no-discretionary-ligatures');
    test('discretionary-ligatures', 'discretionary-ligatures', 'discretionary-ligatures');
    test('no-historical-ligatures', 'no-historical-ligatures', 'no-historical-ligatures');
    test('historical-ligatures', 'historical-ligatures', 'historical-ligatures');

    log("");
    test('no-common-ligatures no-common-ligatures', '', 'normal');
    test('common-ligatures no-discretionary-ligatures', 'common-ligatures no-discretionary-ligatures', 'common-ligatures no-discretionary-ligatures');
    test('common-ligatures no-discretionary-ligatures historical-ligatures', 'common-ligatures no-discretionary-ligatures historical-ligatures', 'common-ligatures no-discretionary-ligatures historical-ligatures');
    test('common-ligatures no-discretionary-ligatures normal', '', 'normal');
</script>
